<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%-- 
    JSP Name : da_300_04K.jsp
    Description : 참여후기 수정(사용자)
    author Ki min
    since 2012. 7. 25.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 7. 25.     Ki min     최초 생성
--%>

<%@ include file="/WEB-INF/jsp/co/us/include/declare.jspf" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">
<head>
<title>현대자동차 CSR &#124; 참여후기</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<%@ include file="/WEB-INF/jsp/co/us/include/header.jspf" %>
<script type="text/javaScript" language="javascript">
$(document).ready(function() {    
    /* form validation check */
    onloadCharCheck();
    
    /* List Page 이동 */
    $("#listButn").bind("click", moveListPage);
    /* Form Submit */
    $("#rgstButn").bind("click", blcSubm);
    /* Form 초기화 */
    $("#cnclButn").bind("click", formIniz);
    /* 편지지 선택  */
    $(":radio[name='letterType'][value='${result.ltrScnCd }']").attr("checked", true);
});

/*
 * 리스트페이지 이동
 */
function moveListPage() {
    $("#hiddenForm").attr('action','/da_300_01.do').submit();
}

/*
 * Form Submit
 */
function blcSubm() {
    if (!validateForm($("#mainForm"))) {
        return;
    } 
    
    if (!isSchrChk($("#pprrNm").val())) {
        alert("[이름] 은 특수문자(!#$%^&*|'<>-;)를 입력할 수 없습니다.");
        $("#title").focus();
        return;
    }
    
    if (!getPasswordChk1($("#pW").val())) {
        alert("[비밀번호] 는 영문 소/대문자 구분 + 숫자 조합으로 10~12자 입니다.");
        $("#pW").focus();
        return;
    }
    
    var eml = $("#eml1").val()+"@"+$("#eml2").val();
    if (!getIDEmailCheck(eml)) {
        alert("[이메일] 형식에 맞지 않습니다.");
        return;
    }
    
    if (!isSchrChk($("#title").val())) {
        alert("[제목] 은 특수문자(!#$%^&*|'<>-;)를 입력할 수 없습니다.");
        $("#title").focus();
        return;
    }
    
    if (getTxtBkmgRmov($("#sbc").val())=="") {
        alert("[내용] 을 입력해주세요.");
        $("#sbc").focus();
        return;
    }
    
    if(confirm("수정 하시겠습니까?")){    
        $("#mainForm").attr('target','comIframe');
        $("#mainForm").attr('action','/da_300_06.do');
        $("#mainForm").submit();
    }
}

/*
 * Form 초기화
 */
function formIniz() {
    $("form").each(function(){
       this.reset(); 
    });
}
</script>
</head>
<body>
<div id="wrap">
    <!-- top -->
    <%@ include file="/WEB-INF/jsp/co/us/include/top.jsp" %>
    <!-- top -->

    <!-- container -->
    <div id="container">
        <div id="contentsWrap">
            <div id="contentsArea">
                <div class="headingArea">
                    <div class="location">
                        <a href="/ma_100_01.do">홈</a>
                        <a href="/da_100_01.do">CSR 자료실</a>
                        <span>참여후기</span>
                    </div>
                    <h2>참여후기</h2>
                </div>
                <div id="contetns">
                    <form id="hiddenForm" name="hiddenForm" method="post">
                        <%-- request --%>
                        <input type="hidden" id="currentPageNo" name="currentPageNo" value="${rqInfo.currentPageNo }" />
                        <input type="hidden" id="srchScn" name="srchScn" value="${rqInfo.srchScn }" />
                        <input type="hidden" id="srchTxt" name="srchTxt" value="${rqInfo.srchTxt }" />
                    </form>
                    <p class="msg"><span class="compulsory">표시는 필수입력 항목입니다.</span></p>
                    <form id="mainForm" name="mainForm" method="post" enctype="multipart/form-data">
                    <input type="hidden" id="blbIdx" name="blbIdx" value="${result.blbIdx }" />
                    <input type="hidden" id="currentPageNo" name="currentPageNo" value="${rqInfo.currentPageNo }" />
                    <input type="hidden" id="srchScn" name="srchScn" value="${rqInfo.srchScn }" />
                    <input type="hidden" id="srchTxt" name="srchTxt" value="${rqInfo.srchTxt }" />
                    <table border="1" class="tableData" summary="참여후기의 내용,첨부파일등이 기재 되어있는 표">
                        <col width="20%" />
                        <col width="30%" />
                        <col width="20%" />
                        <col width="30%" />
                        <tbody>
                            <tr>
                                <td class="subThead"><span class="compulsory">이름</span></td>
                                <td><input type="text" class="name" id="pprrNm" name="pprrNm" title="이름" nullable="true" maxlength="6" minbyte="1" value="${result.pprrNm }" /></td>
                                <td class="subThead depth"><span class="compulsory">비밀번호</span></td>
                                <td><input type="password" id="pW" name="pW" title="비밀번호" nullable="true" minbyte="10" maxbyte="12" maxlength="12" /></td>
                            </tr>
                            <tr>
                                <td class="subThead"><span class="compulsory">이메일</span></td>
                                <td colspan="3"><input type="text" class="mail" id="eml1" name="eml1" nullable="true" title="이메일" maxlength="15" value="${eml1 }" /> &#64; <input type="text" class="mail" id="eml2" name="eml2" nullable="true" title="이메일" maxlength="25" value="${eml2 }" /></td>
                            </tr>
                            <tr>
                                <td class="subThead"><span class="compulsory">연락처</span></td>
                                <td colspan="3">
                                    <input type="text" class="phone" title="연락처" nullable="true" id="hp1" name="hp1" value="${hp1 }" maxlength="4" chartype="onlynum" />
                                     - <input type="text" class="phone" id="hp2" name="hp2" title="연락처" nullable="true" value="${hp2 }" maxlength="4" chartype="onlynum" /> 
                                     - <input type="text" class="phone" id="hp3" name="hp3" title="연락처" nullable="true" value="${hp3 }" maxlength="4" chartype="onlynum" />
                                </td>
                            </tr>
                            <tr>
                                <td class="subThead"><span class="compulsory">제목</span></td>
                                <td colspan="3"><input type="text" id="title" name="title" value="${result.titl }" title="제목" nullable="true" minbyte="2" maxlength="200" /></td>
                            </tr>
                            <tr>
                                <td class="subThead"><span class="compulsory">첨부파일</span></td>
                                <td colspan="3">
                                    <div class="attachArea">
                                        <p>
                                            <input type="file"  name="attcFile" title="첨부파일"/>
                                            <c:if test="${result.filNm != null }">
                                            <a href="#" onclick="getUpFileDownload('0050','${result.blbIdx}');return false;" class="attach">${result.filNm }</a>
                                            </c:if>
                                        </p>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td class="subThead">편지지</td>
                                <td colspan="3" class="letter">
                                    <span class="radioArea">
                                        <label for="chckLetter1"><input type="radio" id="chckLetter1" name="letterType" value="A" /><span class="letter1">편지지</span></label>
                                        <label for="chckLetter2"><input type="radio" id="chckLetter2" name="letterType" value="B" /><span class="letter2">편지지</span></label>
                                        <label for="chckLetter3"><input type="radio" id="chckLetter3" name="letterType" value="C" /><span class="letter3">편지지</span></label>
                                    </span>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="4" class="dataView">
                                    <textarea rows="10" cols="125" id="sbc" name="sbc" >${result.sbc }</textarea>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    </form>
                    <div class="btnArea down">
                        <span class="flow"><a href="#" id="listButn" ><img src="/img/usr/btn/btn_list.gif" alt="목록" /></a></span>
                        <span class="reverse">
                            <input type="image" src="/img/usr/btn/btn_register.gif" id="rgstButn" title="등록" alt="등록" />
                            <input type="image" src="/img/usr/btn/btn_cancel.gif" id="cnclButn" title="취소" alt="취소" />
                        </span>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /container -->

    <!-- footer -->
    <%@ include file="/WEB-INF/jsp/co/us/include/bottom.jsp" %>
    <!-- /footer -->
</div>
</body>
</html>